﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Factonomy.AzureStorageUtility.WindowsApp.Azure;
using Factonomy.AzureStorageUtility.WindowsApp.Resources;

namespace Factonomy.AzureStorageUtility.WindowsApp.UI.Forms
{
    public partial class PromptForString : Form
    {
        public event EventHandler ReturnValue;

        public string Value
        {
            get { return this.uiTextbox.Text; }
        }

        protected virtual void OnReturnValue(object sender, EventArgs e)
        {
            if (ReturnValue != null)
                ReturnValue(sender, e);
        }

        public PromptForString(string text, string buttonText)
        {
            InitializeComponent();

            // set the window icon
            this.Icon = ResourceManager.GetAppIcon();

            this.uiButton.Click += new EventHandler(uiButtonAdd_Click);

            this.Text = text;
            this.uiButton.Text = buttonText;
        }

        void uiButtonAdd_Click(object sender, EventArgs e)
        {
            this.OnReturnValue(this, new EventArgs());
        }
    }
}
